Updated: Trajectory Optimization Through Contacts And Automatic Gait Discovery For Quadrupeds